<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head lang="en">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport">
    <!-- 新 Bootstrap 核心 CSS 文件 -->
    <link rel="stylesheet" href="css/bootstrap.min.css">
    <link rel="stylesheet" href="css/main.css">
    <link rel="stylesheet" href="css/style.css">
    <!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
    <script src="js/jquery.min.js"></script>
    <!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
    <script src="js/bootstrap.min.js"></script>
    <script src="js/style.js"></script>
    <script type="text/javascript" src="js/layer.js"></script>
    <link href="css/layer.css" type="text/css" rel="styleSheet" id="layermcss">
    <script type="text/javascript" src="js/pop.js"></script>
    <script type="text/javascript" src="js/jquery.toast.min.js"></script>
    <script type="text/javascript" src="js/common.js"></script>
    <link rel="stylesheet" href="css/jquery.toast.min.css">
    <title>外賣商品管理</title>
</head>
<script type="text/javascript">

    function toPage(pageNum){
        document.forms[0].action = '../takeOutMenu/menuList.shtml';
        document.forms[0].currentPage.value = pageNum;
        document.forms[0].submit();
    }

    function changeStatus(id){
        var dataval=$('#selStatus'+id).children('option:selected').val()+'';
        var id=id;
        $.ajax({
            type: 'POST',
            async: false,
            url: "../takeOutMenu/changStatus.shtml",
            data:'status='+dataval+'&id='+id,
            success: function(msg){
            }
        });
    };



    function hideConfirm(){
        $('#myModal2').hide();
    }

    function delMenu(){
        $.ajax({
            async: true,
            url: "../takeOutMenu/delMenu.shtml",
            data:encodeURI('menuId='+$("#delId").val()),
            beforeSend: function () {
                pop.loading("");
            },
            success: function(result){
                $('#myModal2').hide();
                window.location = '../takeOutMenu/menuList.shtml';
            },
            complete: function () {
                pop.close();
            }
        });

    }

    function fenlei(obj) {
//        $.ajax({
//            contentType: "text/html;charset=utf-8",
//            async: true,
//            url: "../takeOutMenu/menuTypeModal.shtml",
//            success: function(result){
//                $('#myModal3').show();
//                $("#modal-dialog3").html(result);
//            }
//        });
        $('#myModal3').show();

        $("#myModal3").css( "top", (window.screen.availHeight - this.offsetHeight - 100) / 2 + parent.pageYOffset);
    }
    function hide() {
        $('#myModal3').hide();
        updateTakeOutMenuTypeArray=[];
        arrayData=[];
    }

    function addClassify(obj){
        var _this = $(obj);
        if($("#inputValue").val()==''){
            com.toast("商品分类名称不能为空。");
            return;
        }
        var typeName=$('#inputValue').val();
        $.ajax({
            async: false,
            url: "../takeOutMenu/typeAdd.shtml",
            data:encodeURI('typeName='+typeName),
            beforeSend: function () {
                pop.loading("");
            },
            complete: function () {
                pop.close();
            },
            success: function(result){
                $('#myModal3').show();
                $("#modal-dialog3").html(result);
                com.toast("商品分类保存成功。");
            }
        });
    }



    function deleteType(id){
        var dataVal={"id":id};
        $.ajax({
            type: 'POST',
            async: true,
            dataType:"json",
            contentType:"application/json",
            url: "../takeOutMenu/check.shtml",
            data:JSON.stringify(dataVal),
            beforeSend: function () {
                pop.loading("");
            },
            success: function(result){
                pop.close();
                if(!result){
                    pop.confirm('确定要删除吗？',function(){
                        $.ajax({
                            async: true,
                            url: "../takeOutMenu/menuTypeDel.shtml",
                            data:encodeURI('typeId='+id),
                            success: function(result){
                                $('#type'+id).remove();
                                com.toast("商品分类删除成功。");
                            }
                        });
                    });
                }else{
                    com.toast("该分类下已经存在商品，无法删除。");
                }
            }
        });
    }

    function detail(id){
        $.ajax({
            async: true,
            url: "../takeOutMenu/update.shtml",
            data:encodeURI('menuId='+id),
            success: function(result){
            }
        });
    }

    var updateTakeOutMenuTypeArray = new Array();//编辑的TakeOutMenuType数组
    var arrayData = new Array();//编辑的TakeOutMenuType数组
    function changTypeName(id){
        var type={
            id:'',
            typeName:''
        }
        var oldTypeName=$('#oldValue'+id).val();
        var nowTypeName=$('#nowValue'+id).val();
        if(oldTypeName != nowTypeName){
            type.id=id;
            type.typeName=nowTypeName;
            if(jQuery.inArray(nowTypeName+id,arrayData)<0){//只更新数据修改过的分类
                updateTakeOutMenuTypeArray.push(type);
                arrayData.push(nowTypeName+id);
            }
        }
    }

    function changeName(){
        $('#updateTypeName').show();
    }

    function updateTypeName(){

        if(updateTakeOutMenuTypeArray.length>0){
            $.ajax({
                type: 'POST',
                async: true,
                dataType:"json",
                contentType:"application/json",
                url: "../takeOutMenu/updateTypeName.shtml",
                data:JSON.stringify(updateTakeOutMenuTypeArray),
                beforeSend: function () {
                    pop.loading("");
                },
                complete: function () {
                    pop.close();
                },
                success: function(result){
                    if(result==true){
                        updateTakeOutMenuTypeArray=[];
                        arrayData=[];
                    }
                }
            });
        }
        $('#myModal3').hide();
    }

    function ajaxUpdate(id){

        var seq=$("#sequence"+id).val();
        var oldSeq=$("#oldSeq"+id).val();

        if((seq==''&&oldSeq!='')||isNaN(seq)){
            pop.a('<div style="padding: 10px;"><span>提示信息</span><p style="margin: 20px;">输入的序号不是数字，请重新输入。<p></div>');
            return ;
        }
        if(seq==oldSeq){//如果数据没变不作提交
            return ;
        }
        if(seq<0||seq>2147483647){
            pop.a('<div style="padding: 10px;"><span>提示信息</span><p style="margin: 20px;">输入的序号超出范围，请重新输入。<p></div>');
            return ;
        }

        var data=new Object();
        data.id=id;
        data.sequence=seq;
        $.ajax({
            type: 'POST',
            async: true,
            dataType:"json",
            contentType:"application/json",
            url: "../takeOutMenu/updateSequence.shtml",
            data:JSON.stringify(data),
            beforeSend: function () {
                pop.loading("");
            },
            success: function(result){
                if(result.resultCode==0){
                    window.location = '../takeOutMenu/menuList.shtml';
                }else{
                    com.toast(data.businessMsg.businessNote);
                }
            }
        });
    }

    function ajaxUpdateTypeSeq(id){
        var seq=$("#typeSeq"+id).val();
        var oldSeq=$("#oldTypeSeq"+id).val();

        if((seq==''&&oldSeq!='')||isNaN(seq)){
            pop.a('<div style="padding: 10px;"><span>提示信息</span><p style="margin: 20px;">输入的序号不是数字，请重新输入。<p></div>');
            return ;
        }
        if(seq==oldSeq){//如果数据没变不作提交
            return ;
        }
        if(seq<0||seq>2147483647){
            pop.a('<div style="padding: 10px;"><span>提示信息</span><p style="margin: 20px;">输入的序号超出范围，请重新输入。<p></div>');
            return ;
        }

        $.ajax({
            url: "../takeOutMenu/updateTypeSeq.shtml",
            data:encodeURI('id='+id+'&sequence='+seq),
            beforeSend: function () {
                pop.loading("");
            },
            complete: function () {
                pop.close();
            },
            success: function(result){
                $('#myModal3').show();
                $("#modal-dialog3").html(result);
            }
        });
    }
    function replace(obj) {
        var inp_val = obj.value;
        if (!/[\d]/.test(inp_val)||inp_val < 0) {
            obj.value = inp_val.replace(/[\-\d]|[\-\d\.\d]/g, '');
        }
    }
</script>

<body style="overflow-x: hidden; overflow-y: auto;" onload="Popover()">
<div class="record-main" style="float: left; width: 1061px; height: auto; overflow: auto;">
    <div class="main-title">外賣商品管理</div>
    <div class="record-content">
        <div class="shop-list-tooltip" style="margin-top: 56px; margin-left: 10px; margin-bottom: 30px;">
            <button type="button"  class="btn btn-default add-border" style="border: 1px solid #00a189; outline: none; color: #00a189; margin-right: 20px;">
                <a href="w-shop-add.html">添加商品</a>
            </button>
            <button type="button" onclick="fenlei();" class="btn btn-default add-border" style="border: 1px solid #00a189; outline: none; color: #00a189; margin-right: 20px;">
                <a href="" data-toggle="modal" data-target="#myModal">商品分類</a>
            </button>
            <button type="button"  class="btn btn-default add-border" style="border: 1px solid #00a189; outline: none; color: #00a189; margin-right: 20px;">
                <a href="" onclick="Addshop()" data-toggle="modal" data-target="#myModal">批量添加商品</a>
            </button>

            <!--<button type="button" class="btn btn-default add-border"-->
                <!--style="border: 1px solid #00a189; outline: none; color: #00a189;">同步數據到其他門店</button>-->
           <!--<button class="badge"-->
                <!--style="background: white; color: #00a189; border: 1px solid #00a189; margin-left: 10px;outline: none;" rel="popover" data-trigger="focus" data-placement="top"-->
                 <!--data-content="當你有多個門店時，其中一個門店的額商品有更新且希望商品更新能同步到其他門店時，可以點擊”同步到其他門店“按鈕即可輕鬆實現。">?</button>-->
        </div>
        <div class="shop-select-box">
            <div class="Category-box">
                <div class="Category-title">
                    <span>商品分類：</span>
                </div>
                <div class="classify-list">
                    <ul>
                        <li role="" class="active"><a href="#">能量主食 <span>(42)</span></a></li>
                        <li><a href="#">招牌贡茶（奶盖）<span>(4)</span></a></li>
                        <li><a href="#">Pure tea 纯茶<span>(7)</span></a></li>
                        <li><a href="#">Creative 创意系列<span>(5)</span></a></li>
                        <li><a href="#">Coffee 咖啡<span>(12)</span></a></li>
                        <li><a href="#">Milk Tea 奶茶精选<span>(2)</span></a></li>
                        <li><a href="#">Coffee<span>(12)</span></a></li>
                    </ul>
                </div>
            </div>
            <div class="group-list-search" style="clear: both">
                <form action="" method="post" action="" method="post">
                    <input type="hidden" name="currentPage" value="1" />
                    <div class="group-list-lx">
                        <span style="float: left; margin-right: 10px; margin-top: 7px; color: #6c6666;">商品名稱</span>
                        <div class="form-group" style="margin-right: 30px; width: 120px;">
                            <input type="text" name="name" value="" class="form-control" />
                        </div>
                    </div>
                    <div class="group-list-md">
                        <span style="float: left; margin-right: 10px; margin-top: 7px; color: #6c6666;">商品銷售狀態</span>
                        <div class="form-group" style="margin-right: 10px; width: 160px;">
                            <select name="status" class="form-control select-tc" style="height: 35px;">
                                <option value="">全部</option>
                                <option  value="0">待售中</option>
                                <option  value="1">售賣中</option>
                                <option  value="2">已售完</option>
                            </select>
                        </div>
                    </div>
                    <div class="group-list-button">
                        <button type="submit" class="btn btn-default arrive-reach" style="background: #00a189; color: white; border: 1px solid #00a189;">搜索</button>
                    </div>
                </form>
            </div>
        </div>
        <div class="shop-checked-box">
            <div class="checked-big-box">
                <span class="checkbox-box"><input type="checkbox"/><lable class="label">全选</lable></span>
            </div>
            <div class="batch-box">
                <button  class="btn btn-default batch-standard"  onclick="addStandard()">批量修改規格</button>
                <button class="btn btn-default batch-property" onclick="addProperty()">批量修改屬性</button>
                <button class="btn btn-default batch-property" onclick="del_batch()">批量删除</button>
                <button type="button" class="btn btn-default batch-property"  rel="popover_standard" data-placement="bottom" style="background: white">批量修改库存</button>
                <button class="btn btn-default batch-property" rel="popover_f_price" data-placement="bottom">批量修改餐盒價格</button>
                <button class="btn btn-default batch-property" rel="popover_f_number" data-placement="bottom">批量修改餐盒數量</button>
                <button class="btn btn-default batch-property" rel="popover_fenlei" data-placement="bottom">批量修改</button>
                <button class="btn btn-default batch-property" rel="popover_fenlei" data-placement="bottom">批量修改分類</button>
                <button class="btn btn-default batch-property" rel="popover_fenlei" data-placement="bottom">批量修改分類</button>
                <button class="btn btn-default batch-property" rel="popover_fenlei" data-placement="bottom">批量修改分類</button>
                <button class="btn btn-default batch-property" rel="popover_fenlei" data-placement="bottom">批量修改分類</button>
            </div>
        </div>
        <div class="popover-box">
            <div class="popover_standard">
                <input type="number" class="form-control"/>
                <div class="text-center btn-box">
                    <button type="button" class="btn btn-default">取消</button>
                    <button type="button" class="btn btn-default">確認</button>
                </div>
            </div>
            <div class="popover_f_price">
                <input type="number" min="0" class="form-control"/>
                <div class="text-center btn-box">
                    <button type="button" class="btn btn-default">取消</button>
                    <button type="button" class="btn btn-default">確認</button>
                </div>
            </div>
            <div class="popover_f_number">
                <input type="number" min="0" class="form-control"/>
                <div class="text-center btn-box">
                    <button type="button" class="btn btn-default">取消</button>
                    <button type="button" class="btn btn-default">確認</button>
                </div>
            </div>
            <div class="popover_fenlei">
                <select class="form-control"/>
                     <option value="">能量主食</option>
                     <option value="">閨蜜盛宴</option>
                </select>
                <div class="text-center btn-box">
                    <button type="button" class="btn btn-default">取消</button>
                    <button type="button" class="btn btn-default">確認</button>
                </div>
            </div>
        </div>
        <div class="shop-list-table">
            <table class="list-table-content" id="shop-table">
                <tr>
                    <th></th>
                    <th>序號</th>
                    <th>商品名稱</th>
                    <th>圖片</th>
                    <th>商品分類</th>
                    <th>單位</th>
                    <th style="width: 100px;">规格</th>
                    <th style="width: 100px;">價格</th>
                    <th style="width: 100px;">庫存</th>
                    <th>起訂數</th>
                    <th>售賣狀態</th>
                    <th>操作</th>
                </tr>
                <tr>
                    <td><input type="checkbox"/></td>
                    <td class="order-number"><input type="hidden" name="oldSeq"  value="1" /> <input type="text"  onkeyup="replace(this);" onblur="ajaxUpdate(this)" class="form-control" name="sequence" id="sequence201610110931370112939930" size="1" maxlength="10" value="1" min="0" /></td>
                    <td>贡茶</td>
                    <td>
                        <div class="shop-list-img">
                            <img src="images/xlx.jpg" alt="" />
                        </div>
                    </td>
                    <td>热销</td>
                    <td>杯</td>
                    <td colspan="3">
                        <div class="table-div">
                              <ul class="table-ul">
                                  <li>冷</li>
                                  <li>20</li>
                                  <li>无限</li>
                              </ul>
                              <ul class="table-ul">
                                <li>-</li>
                                <li>110</li>
                                <li>无限</li>
                              </ul>
                              <ul class="table-ul">
                                <li>大杯</li>
                                <li>25</li>
                                <li>无限</li>
                            </ul>
                        </div>
                    </td>
                    <td rowspan="1">2</td>
                    <td rowspan="1"><select onchange="changeStatus();"  style="border: none">
                        <option value="1" selected>售賣中</option>
                        <option value="2">已售完</option>
                        <option value="0" >待售中</option>
                    </select></td>
                    <td rowspan="1" class="last-td"><a href="w-shop-modif.html"  class="btn btn-default">修改</a> <a href="group-affirm.html"  class="btn btn-default" data-toggle="modal" data-target="#myModal" onclick="del()">刪除</a></td>
                </tr>
                <tr>
                <td><input type="checkbox"/></td>
                <td class="order-number"><input type="hidden" name="oldSeq"  value="1" /> <input type="text"  onkeyup="replace(this);" onblur="ajaxUpdate(this)" class="form-control" name="sequence" id="sequence201610110931370112939930" size="1" maxlength="10" value="1" min="0" /></td>
                <td>贡茶</td>
                <td>
                    <div class="shop-list-img">
                        <img src="images/xlx.jpg" alt="" />
                    </div>
                </td>
                <td>热销</td>
                <td>杯</td>
                <td colspan="3">
                    <div class="table-div">
                        <ul class="table-ul">
                            <li>冷</li>
                            <li>20</li>
                            <li>无限</li>
                        </ul>
                        <ul class="table-ul">
                            <li>-</li>
                            <li>110</li>
                            <li>无限</li>
                        </ul>
                        <ul class="table-ul">
                            <li>大杯</li>
                            <li>25</li>
                            <li>无限</li>
                        </ul>
                    </div>
                </td>
                <td rowspan="1">2</td>
                <td rowspan="1"><select onchange="changeStatus();"  style="border: none">
                    <option value="1" selected>售賣中</option>
                    <option value="2">已售完</option>
                    <option value="0" >待售中</option>
                </select></td>
                <td rowspan="1" class="last-td"><a href="w-shop-modif.html"  class="btn btn-default">修改</a> <a href="group-affirm.html"  class="btn btn-default" data-toggle="modal" data-target="#myModal" onclick="del()">刪除</a></td>
            </tr>
                <tr>
                    <td><input type="checkbox"/></td>
                    <td class="order-number"><input type="hidden" name="oldSeq"  value="1" /> <input type="text"  onkeyup="replace(this);" onblur="ajaxUpdate(this)" class="form-control" name="sequence" id="sequence201610110931370112939930" size="1" maxlength="10" value="1" min="0" /></td>
                    <td>贡茶</td>
                    <td>
                        <div class="shop-list-img">
                            <img src="images/xlx.jpg" alt="" />
                        </div>
                    </td>
                    <td>热销</td>
                    <td>杯</td>
                    <td colspan="3">
                        <div class="table-div">
                            <ul class="table-ul">
                                <li>冷</li>
                                <li>20</li>
                                <li>无限</li>
                            </ul>
                            <ul class="table-ul">
                                <li>-</li>
                                <li>110</li>
                                <li>无限</li>
                            </ul>
                            <ul class="table-ul">
                                <li>大杯</li>
                                <li>25</li>
                                <li>无限</li>
                            </ul>
                        </div>
                    </td>
                    <td rowspan="1">2</td>
                    <td rowspan="1"><select onchange="changeStatus();"  style="border: none">
                        <option value="1" selected>售賣中</option>
                        <option value="2">已售完</option>
                        <option value="0" >待售中</option>
                    </select></td>
                    <td rowspan="1" class="last-td"><a href="w-shop-modif.html"  class="btn btn-default del">修改</a> <a href="group-affirm.html"  class="btn btn-default" data-toggle="modal" data-target="#myModal" onclick="del()">刪除</a></td>
                </tr>
                <tr>
                    <td><input type="checkbox"/></td>
                    <td class="order-number"><input type="hidden" name="oldSeq"  value="1" /> <input type="text"  onkeyup="replace(this);" onblur="ajaxUpdate(this)" class="form-control" name="sequence" id="sequence201610110931370112939930" size="1" maxlength="10" value="1" min="0" /></td>
                    <td>贡茶</td>
                    <td>
                        <div class="shop-list-img">
                            <img src="images/xlx.jpg" alt="" />
                        </div>
                    </td>
                    <td>热销</td>
                    <td>杯</td>
                    <td colspan="3">
                        <div class="table-div">
                            <ul class="table-ul">
                                <li>冷</li>
                                <li>20</li>
                                <li>无限</li>
                            </ul>
                            <ul class="table-ul">
                                <li>-</li>
                                <li>110</li>
                                <li>无限</li>
                            </ul>
                            <ul class="table-ul">
                                <li>大杯</li>
                                <li>25</li>
                                <li>无限</li>
                            </ul>
                        </div>
                    </td>
                    <td rowspan="1">2</td>
                    <td rowspan="1"><select onchange="changeStatus();"  style="border: none">
                        <option value="1" selected>售賣中</option>
                        <option value="2">已售完</option>
                        <option value="0" >待售中</option>
                    </select></td>
                    <td rowspan="1" class="last-td"><a href="w-shop-modif.html"  class="btn btn-default">修改</a> <a href="group-affirm.html"  class="btn btn-default" data-toggle="modal" data-target="#myModal" onclick="del()">刪除</a></td>
                </tr>
                <tr>
                    <td><input type="checkbox"/></td>
                    <td class="order-number"><input type="hidden" name="oldSeq"  value="1" /> <input type="text"  onkeyup="replace(this);" onblur="ajaxUpdate(this)" class="form-control" name="sequence" id="sequence201610110931370112939930" size="1" maxlength="10" value="1" min="0" /></td>
                    <td>贡茶</td>
                    <td>
                        <div class="shop-list-img">
                            <img src="images/xlx.jpg" alt="" />
                        </div>
                    </td>
                    <td>热销</td>
                    <td>杯</td>
                    <td colspan="3">
                        <div class="table-div">
                            <ul class="table-ul">
                                <li>冷</li>
                                <li>20</li>
                                <li>无限</li>
                            </ul>
                            <ul class="table-ul">
                                <li>-</li>
                                <li>110</li>
                                <li>无限</li>
                            </ul>
                            <ul class="table-ul">
                                <li>大杯</li>
                                <li>25</li>
                                <li>无限</li>
                            </ul>
                        </div>
                    </td>
                    <td rowspan="1">2</td>
                    <td rowspan="1"><select onchange="changeStatus();"  style="border: none">
                        <option value="1" selected>售賣中</option>
                        <option value="2">已售完</option>
                        <option value="0" >待售中</option>
                    </select></td>
                    <td rowspan="1" class="last-td"><a href="w-shop-modif.html"  class="btn btn-default">修改</a> <a href="group-affirm.html"  class="btn btn-default" data-toggle="modal" data-target="#myModal" onclick="del()">刪除</a></td>
                </tr>
                <tr>
                    <td><input type="checkbox"/></td>
                    <td class="order-number"><input type="hidden" name="oldSeq"  value="1" /> <input type="text"  onkeyup="replace(this);" onblur="ajaxUpdate(this)" class="form-control" name="sequence" id="sequence201610110931370112939930" size="1" maxlength="10" value="1" min="0" /></td>
                    <td>贡茶</td>
                    <td>
                        <div class="shop-list-img">
                            <img src="images/xlx.jpg" alt="" />
                        </div>
                    </td>
                    <td>热销</td>
                    <td>杯</td>
                    <td colspan="3">
                        <div class="table-div">
                            <ul class="table-ul">
                                <li>冷</li>
                                <li>20</li>
                                <li>无限</li>
                            </ul>
                            <ul class="table-ul">
                                <li>-</li>
                                <li>110</li>
                                <li>无限</li>
                            </ul>
                            <ul class="table-ul">
                                <li>大杯</li>
                                <li>25</li>
                                <li>无限</li>
                            </ul>
                        </div>
                    </td>
                    <td rowspan="1">2</td>
                    <td rowspan="1"><select onchange="changeStatus();"  style="border: none">
                        <option value="1" selected>售賣中</option>
                        <option value="2">已售完</option>
                        <option value="0" >待售中</option>
                    </select></td>
                    <td rowspan="1" class="last-td"><a href="w-shop-modif.html"  class="btn btn-default">修改</a> <a href="group-affirm.html"  class="btn btn-default" data-toggle="modal" data-target="#myModal" onclick="del()">刪除</a></td>
                </tr>  <tr>
                <td><input type="checkbox"/></td>
                <td class="order-number"><input type="hidden" name="oldSeq"  value="1" /> <input type="text"  onkeyup="replace(this);" onblur="ajaxUpdate(this)" class="form-control" name="sequence" id="sequence201610110931370112939930" size="1" maxlength="10" value="1" min="0" /></td>
                <td>贡茶</td>
                <td>
                    <div class="shop-list-img">
                        <img src="images/xlx.jpg" alt="" />
                    </div>
                </td>
                <td>热销</td>
                <td>杯</td>
                <td colspan="3">
                    <div class="table-div">
                        <ul class="table-ul">
                            <li>冷</li>
                            <li>20</li>
                            <li>无限</li>
                        </ul>
                        <ul class="table-ul">
                            <li>-</li>
                            <li>110</li>
                            <li>无限</li>
                        </ul>
                        <ul class="table-ul">
                            <li>大杯</li>
                            <li>25</li>
                            <li>无限</li>
                        </ul>
                    </div>
                </td>
                <td rowspan="1">2</td>
                <td rowspan="1"><select onchange="changeStatus();"  style="border: none">
                    <option value="1" selected>售賣中</option>
                    <option value="2">已售完</option>
                    <option value="0" >待售中</option>
                </select></td>
                <td rowspan="1" class="last-td"><a href="w-shop-modif.html"  class="btn btn-default">修改</a> <a href="group-affirm.html"  class="btn btn-default del" data-toggle="modal" data-target="#myModal" onclick="del()">刪除</a></td>
            </tr>

            </table>
        </div>
        <div class="page-list">
            <div class="page text-center">
                <a class="page-btn" style="border: 1px solid gainsboro;padding: 5px;color: #6c6666;">首頁</a>
                <a class="page-btn" style="border: 1px solid gainsboro;padding: 5px;color: #6c6666;margin: 0 -5px;"><img
                        src="images/pre-page.png" width="18px" alt=""/></a>
                <a class="page-btn" style="border: 1px solid gainsboro;padding: 5px;color: #6c6666;">1</a>
                <a class="page-btn next-page" style="border: 1px solid gainsboro;padding: 5px;color: #6c6666;margin: 0 -5px;"><img
                        src="images/next-page.png" width="18px" alt=""/></a>
                <a class="page-btn" style="border: 1px solid gainsboro;padding: 5px;color: #6c6666;">尾頁</a>
                <a class="" style="color: #6c6666;border: none">go</a>
                <a class="page-btn" style="border: 1px solid gainsboro;padding: 5px 10px;color: #6c6666;">1</a>
                <span style="color: #6c6666;">頁</span>
            </div>
        </div>
    </div>
</div>
<!-- 商品分類管理 -->
<div class="myModal" id="myModal3" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" id="modal-dialog3" role="document" style="width: 500px;height:370px;">
        <form action="" name="ff">
            <div class="modal-content">
                <div class="modal-body del-modal class-list-modal" style="border-bottom: 1px dashed gainsboro;clear: both;padding: 20px 20px;" >
                    <h4 style="color: #6c6666;">商品分類管理</h4>
                    <a  style="float: right;text-decoration:none;margin-top:-35px;text-align: center;font-size: 20px;color: #6c6666;cursor: pointer" onclick="hide()">×</a>
                    <div style="clear: both;margin-top: 20px;">
                        <div class="form-group" style="clear:both;margin-right: 20px;width: 280px;">
                            <input type="text" class="form-control" id="inputValue" name="input1" onkeyup="keydown()" placeholder="請輸入分類商品名稱"/>
                        </div>
                        <a class="btn btn-defalut" style="width: 80px;height: 30px;border: 1px solid #00a189;color:#00a189;border-radius: 5px;text-align: center;line-height: 20px;" onclick="addClassify(this)">增加分類</a>
                    </div>
                </div>
                <div class="class-list" style="padding: 20px;" id="sortable">
                    <div class="row">
                        <div class="col-md-3 class-number">
                            <span>序號</span>
                        </div>
                        <div class="col-md-9 class-fenlei">
                            <span>分類名稱</span>
                        </div>
                    </div>
                    <div class="form-group">
                        <aside id="list_1">
                            <div class="row class-hide">
                                <div class="col-md-3 class-number-input" >
                                    <input name="input2" type="text" class="form-control" placeholder=""/>
                                </div>
                                <div class="col-md-6 class-fenlei-input">
                                    <input  name="input2" type="text" class="form-control" placeholder=""/>
                                </div>
                                <div class="col-md-3 class-del-btn" >
                                    <span  class="del-btn" onclick="$(this).closest('.class-hide').remove();"></span>
                                </div>
                            </div>
                        </aside>
                    </div>
                </div>
                <div class="modal-footer class-list-btn" style="border-top: none">
                    <button type="button" class="btn btn-default" style="outline:none;color: #6c6666;border-radius:5px;" onclick="hide()">取消</button>
                    <button type="button" class="btn btn-default" style="border-radius:5px;background:#00a189;outline:none;">
                        <a href="#" onclick="exist()" style="color: #ffffff;text-decoration: none">保存</a></button>
                </div>
            </div>
        </form>
    </div>
</div>
<!-- 刪除確認Modal -->
<div class="myModal" id="myModal2" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog modal-dialog-1" id="modal-dialog2" role="document" style="width: 500px; height: 370px;">
        <form action="">
            <div class="modal-content">
                <div class="modal-body del-modal">
                    系統提示
                    <h5 class="text-center">確定要刪除該商品嗎？</h5>
                </div>
                <div class="modal-footer" style="border-top: none; text-align: center; margin-bottom: 20px;">
                    <input type="hidden" id="delId" name="delId">
                    <button type="button" class="btn btn-default" style="outline: none; color: #6c6666; border-radius: 5px;" onclick="hideConfirm()">關閉</button>
                    <button type="button" class="btn btn-default" id="" data-dismiss="modal" style="border-radius: 5px; background: #00a189; outline: none; color: #ffffff" onclick="delMenu()">確定</button>
                </div>
            </div>
        </form>
    </div>
</div>
<!-- 批量添加商品 -->
<div class="myModal" id="myModalAdd" style="display: none; z-index: 999" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog shop-dialog" id="modal-dialogAdd" role="document" style="width: 500px;max-height: 600px;">
        <form action="">
            <div class="modal-content">
                <div class="modal-body">
                    <div class="modal-title">
                        <h4 style="">批量添加商品</h4>
                    </div>
                    <div  class="modal-shop-content">
                        <div class="shop-content">
                            <textarea class="form-control " placeholder="批量添加仅支持一种规格商品" maxlength="500" name="notice" id="notice" rows="5"
                                      style="width: 470px;max-width:470px;height: 220px;"></textarea>
                        </div>
                        <div class="shop-message">
                            <div>
                                <label>填寫說明</label>
                                <p>#分類名</p>
                                <p>名稱(必填)&nbsp;價格(必填)&nbsp;餐盒價格&nbsp;餐盒数量&nbsp;商品單位&nbsp;起售數</p>
                                <p>字段間以空格分隔，非必填項未設置時系統將按默認值填充，示例如下：</p>
                                <br>#飲料</br>冰紅茶&nbsp;5</br>果粒橙&nbsp;5</p>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="modal-footer text-center">
                    <button type="button" class="btn btn-default" style="outline: none; color: #6c6666; border-radius: 5px;" onclick="hideshop()">取消</button>
                    <button type="button" class="btn btn-default" data-dismiss="modal" style="border-radius: 5px; background: #00a189; outline: none;">
                        <a id="" href="javascript:saveShop();" style="color: #ffffff; text-decoration: none">保存</a>
                    </button>
                </div>
            </div>
        </form>
    </div>
</div>
<!-- 批量修改商品规格 -->
<div class="myModal" id="myModalStandard" style="display: none; z-index: 999;" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog shop-dialog" id="modal-dialogStandard" role="document" style="width: 760px; max-height: 600px;">
        <form action="">
            <div class="modal-content">
                <div class="modal-body">
                    <div class="modal-title">
                        <h4 style="">批量修改商品規格</h4>
                        <a  style="float: right;text-decoration:none;margin-top:-35px;text-align: center;font-size: 20px;color: #6c6666;cursor: pointer" onclick="hidestandrad()">×</a>
                    </div>
                    <div  class="modal-shop-content" style="max-height: 400px;overflow: auto;">
                        <p class="warning-message"><span>保存后，所選商品的規格、價格、庫存都會更新為下方輸入內容，請謹慎操作</span></p>
                        <div class="form-group add-standard-list">
                            <div class="standard-default">
                                <div class="standard-list" id="standard-default">
                                    <div class="standard-box standard-stan">
                                        <span><i class="add-star" style="margin: 5px; color: #00a189;">*</i>规格</span>
                                        <p><input type="text" rel="popover" onfocus="showstandard(this)" data-trigger="focus" data-placement="bottom" data-placement="bottom"  maxlength="10" id="standard"class="form-control"/></p>
                                    </div>
                                    <div class="standard-box standard-price">
                                        <span><i class="add-star" style="margin: 5px; color: #00a189;">*</i>價格</span>
                                        <p><input type="number" min="0" class="form-control"/></p>
                                    </div>
                                    <div class="standard-box standard-num">
                                        <span><i class="add-star" style="margin: 5px; color: #00a189;">*</i>库存</span>
                                        <p><input type="number" placeholder="1" class="form-control" data-toggle="popover" data-placement="right" data-content="库存无限请填写-1" data-trigger="focus"/></p>
                                    </div>
                                    <div class="standard-box standard-meal-price">
                                        <span><i class="add-star" style="margin: 5px; color: #00a189;">*</i>餐盒價格</span>
                                        <p><input type="number" placeholder="0" min="0" class="form-control"/></p>
                                    </div>
                                    <div class="standard-box standard-meal-number">
                                        <span><i class="add-star" style="margin: 5px; color: #00a189;">*</i>餐盒数量</span>
                                        <p><input type="number" placeholder="1" min="0" class="form-control"/></p>
                                    </div>
                                </div>
                            </div>
                            <div class="prepend-standard-show">
                            </div>
                            <div class="strandard-message" id="strandard-message">
                                <dl class="strandard-dl">
                                    <dd class="strandard-dd" onclick="demo(this,3)">大份</dd>
                                    <dd class="strandard-dd" onclick="demo(this,3)">
                                        中份
                                    </dd>
                                    <dd class="strandard-dd" onclick="demo(this,3)">
                                        小份
                                    </dd>
                                    <dd class="strandard-dd" onclick="demo(this,3)">
                                        大
                                    </dd>
                                    <dd class="strandard-dd" onclick="demo(this,3)">
                                        中
                                    </dd>
                                    <dd class="strandard-dd" onclick="demo(this,3)">
                                        小
                                    </dd>
                                    <dd class="strandard-dd" onclick="demo(this,3)">
                                        一份
                                    </dd>
                                    <dd class="strandard-dd" onclick="demo(this,3)">
                                        半份
                                    </dd>
                                    <dd class="strandard-dd" onclick="demo(this,3)">
                                        6寸
                                    </dd>
                                    <dd class="strandard-dd" onclick="demo(this,3)">
                                        8寸
                                    </dd>
                                    <dd class="strandard-dd" onclick="demo(this,3)">
                                        9寸
                                    </dd>
                                    <dd class="strandard-dd" onclick="demo(this,3)">
                                        10寸
                                    </dd>
                                    <dd class="strandard-dd" onclick="demo(this,3)">
                                        12寸
                                    </dd>
                                    <dd class="strandard-dd" onclick="demo(this,3)">
                                        14寸
                                    </dd>
                                    <dd class="strandard-dd" onclick="demo(this,3)">
                                        超大杯
                                    </dd>
                                    <dd class="strandard-dd" onclick="demo(this,3)">
                                        大杯
                                    </dd>
                                    <dd class="strandard-dd" onclick="demo(this,3)">
                                        中杯
                                    </dd>
                                    <dd class="strandard-dd" onclick="demo(this,3)">
                                        标准杯
                                    </dd>
                                    <dd class="strandard-dd" onclick="demo(this,3)">
                                        小杯
                                    </dd>
                                </dl>
                            </div>
                            <div class="add-property add-standard" id="addStandard">添加规格</div>
                        </div>
                    </div>
                </div>
                <div class="modal-footer text-center">
                    <button type="button" class="btn btn-default" style="outline: none; color: #6c6666; border-radius: 5px;" onclick="hidestandrad()">取消</button>
                    <button type="button" class="btn btn-default" data-dismiss="modal" style="border-radius: 5px; background: #00a189; outline: none;">
                        <a id="" href="javascript:saveStandard()" style="color: #ffffff; text-decoration: none">保存</a>
                    </button>
                </div>
            </div>
        </form>
    </div>
</div>
<!-- 批量修改商品屬性 -->
<div class="myModal" id="myModalProperty" style="display: none; z-index: 999" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog shop-dialog" id="modal-dialogProperty" role="document" style="width: 500px; max-height: 600px;">
        <form action="">
            <div class="modal-content">
                <div class="modal-body">
                    <div class="modal-title">
                        <h4 style="">批量修改商品屬性</h4>
                    </div>
                    <div  class="modal-shop-content" style="max-height: 400px;overflow: auto">
                        <div class="name" style="clear: both">
                            <div class="form-group add-property-list">
                                <div class="property-default">
                                    <div class="property" style="margin-top: 10px;height: 40px;"><input type="text"  id="property' + index
                        "name="property" rel="popover1" data-trigger="focus" data-placement="bottom" style="float: left;" class="sure-pwd form-control required" placeholder="例如:口味" onfocus="showproperty(this)" oninput="che" /><input type="text" id="propertyPram' + index
                        " name="propertyPram" rel="popoverPropertyValue" onfocus="showproperty(this)" data-placement="bottom" class="sure-pwd form-control required" style="margin-left: 10px;"  placeholder="例如:少盐,用空格隔开"/><a onclick="getDel(this);" class="del-box del-btn"></a></div>
                                </div>
                                <div class="add-list"></div>
                                <div class="property-message">
                                    <div class="strandard-message" id="box1-list" style="margin-right: 10px; display: none">
                                        <dl class="strandard-dl">
                                            <dd class="strandard-dd propertyDd">溫度</dd>
                                            <dd class="strandard-dd propertyDd">冷热</dd>
                                            <dd class="strandard-dd propertyDd">辣度</dd>
                                            <dd class="strandard-dd propertyDd">口味</dd>
                                            <dd class="strandard-dd propertyDd">甜度</dd>
                                            <dd class="strandard-dd propertyDd">加料</dd>
                                        </dl>
                                    </div>
                                    <div class="message-box1 message-box2 box2_list">
                                        <div class="strandard-message" id="box2_list1">
                                            <dl class="strandard-dl">
                                                <dd class="strandard-dd propertyVal">热</dd>
                                                <dd class="strandard-dd propertyVal">常温</dd>
                                                <dd class="strandard-dd propertyVal">去冰</dd>
                                                <dd class="strandard-dd propertyVal">少冰</dd>
                                            </dl>
                                        </div>
                                        <div class="strandard-message" id="box2_list2">
                                            <dl class="strandard-dl">
                                                <dd class="strandard-dd propertyVal">热</dd>
                                                <dd class="strandard-dd propertyVal" >常温</dd>
                                                <dd class="strandard-dd propertyVal" >去冰</dd>
                                                <dd class="strandard-dd propertyVal">少冰</dd>
                                            </dl>
                                        </div>
                                        <div class="strandard-message" id="box2_list3">
                                            <dl class="strandard-dl">
                                                <dd class="strandard-dd propertyVal">特辣</dd>
                                                <dd class="strandard-dd propertyVal">麻辣</dd>
                                                <dd class="strandard-dd propertyVal">中辣</dd>
                                                <dd class="strandard-dd propertyVal">微辣</dd>
                                            </dl>
                                        </div>
                                        <div class="strandard-message" id="box2_list4">
                                            <dl class="strandard-dl">
                                                <dd class="strandard-dd propertyVal">特辣</dd>
                                                <dd class="strandard-dd propertyVal">麻辣</dd>
                                                <dd class="strandard-dd propertyVal">中辣</dd>
                                                <dd class="strandard-dd propertyVal">微辣</dd>
                                                <dd class="strandard-dd propertyVal">微微辣</dd>
                                                <dd class="strandard-dd propertyVal">清淡</dd>
                                                <dd class="strandard-dd propertyVal">少盐</dd>
                                            </dl>
                                        </div>
                                        <div class="strandard-message" id="box2_list5">
                                            <dl class="strandard-dl">
                                                <dd class="strandard-dd propertyVal">无糖</dd>
                                                <dd class="strandard-dd propertyVal">少糖</dd>
                                                <dd class="strandard-dd propertyVal">半糖</dd>
                                                <dd class="strandard-dd propertyVal">多糖</dd>
                                            </dl>
                                        </div>
                                        <div class="strandard-message" id="box2_list6">
                                            <dl class="strandard-dl">
                                                <dd class="strandard-dd propertyVal">珍珠</dd>
                                                <dd class="strandard-dd propertyVal">椰果</dd>
                                                <dd class="strandard-dd propertyVal">波霸</dd>
                                                <dd class="strandard-dd propertyVal">红豆</dd>
                                            </dl>
                                        </div>
                                    </div>
                                </div>
                                <div class="add-property" id="add">添加屬性</div>
                            </div>
                        </div>
                </div>
                <div class="modal-footer text-center">
                    <button type="button" class="btn btn-default" style="outline: none; color: #6c6666; border-radius: 5px;" onclick="hideProperty()">取消</button>
                    <button type="button" class="btn btn-default" data-dismiss="modal" style="border-radius: 5px; background: #00a189; outline: none;">
                        <a id="" href="javascript:saveProprety()" style="color: #ffffff; text-decoration: none">保存</a>
                    </button>
                </div>
            </div>
            </div>
        </form>
    </div>
</div>
<!-- 批量刪除 -->
<div class="myModal" id="myModalDel_batch" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" id="modal-dialog_batch" role="document" style="width: 500px;height:370px;">
        <form action="" name="ff">
            <div class="modal-content del-batch">
                <div class="modal-body del-modal class-list-modal">
                    <h4 style="color: #6c6666;margin:0;">系統提示</h4>
                    <a  style="float: right;text-decoration:none;margin-top:-25px;text-align: center;font-size: 20px;color: #6c6666;cursor: pointer" onclick="hide_del_batch()">×</a>

                </div>
                <div class="del-batch-conten">
                    <p>确定要批量删除该商品吗？</p>
                </div>
                <div class="modal-footer class-list-btn btn-box">
                    <button class="btn btn-default" onclick="hide_del_batch()">取消</button>
                    <button class="btn btn-default" onclick="hide_del_batch()">保存</button>
                </div>
            </div>
        </form>
    </div>
</div>
<script>

    $(function () {
        $("[rel='popover_standard']").popover({
            html:true,
            content: function() {
                return $('.popover_standard').html();
            }
        }).click(function() {
            $(this).popover('show');
        });
        $("[rel='popover_f_price']").popover({
            html:true,
            content: function() {
                return $('.popover_f_price').html();
            }
        }).click(function(){
            $(this).popover('show');
        });
        $("[rel='popover_f_number']").popover({
            html:true,
            content: function() {
                return $('.popover_f_number').html();
            }
        }).click(function(){
            $(this).popover('show');
        });
        $("[rel='popover_fenlei']").popover({
            html:true,
            content: function() {
                return $('.popover_fenlei').html();
            }
        }).click(function(){
            $(this).popover('show');
        });

    });
    $(document).on('click','button',function(){
        if(this.id == 'popover_stock'){
            $("[rel='popover_f_price']").popover('hide');
            $("[rel='popover_f_number']").popover('hide');
            $("[rel='popover_fenlei']").popover('hide');
        }else if(this.id == 'popover_f_price'){
            $("[rel='popover_standard']").popover('hide');
            $("[rel='popover_f_number']").popover('hide');
            $("[rel='popover_fenlei']").popover('hide');
        }else if(this.id == 'popover_f_number'){
            $("[rel='popover_standard']").popover('hide');
            $("[rel='popover_f_price']").popover('hide');
            $("[rel='popover_fenlei']").popover('hide');
        }
        else if(this.id == 'popover_fenlei'){
            $("[rel='popover_standard']").popover('hide');
            $("[rel='popover_f_price']").popover('hide');
            $("[rel='popover_f_number']").popover('hide');
        }else{
            hideBatchPopover();
        }
    })
    //隱藏所以popover
    function hideBatchPopover(){
        $("[rel='popover_standard']").popover('hide');
        $("[rel='popover_f_price']").popover('hide');
        $("[rel='popover_f_number']").popover('hide');
        $("[rel='popover_fenlei']").popover('hide');
    }
    //取消按鈕調用隱藏所以popover
    $(document).on("click",".cancelBatch",function(){
        hideBatchPopover();
    })
//批量刪除
    function del_batch(){
        $('#myModalDel_batch').show();
    }
    function hide_del_batch() {
        $('#myModalDel_batch').hide();
    }
    function fenlei() {
        $('#myModal3').show();
    }
    function hide() {
        $('#myModal3').hide();
    }
function addProperty() {
    $('#myModalProperty').show();
}
function addStandard() {
//    var scrollTop = parent.document.body.scrollTop;
//    document.getElementById("modal-dialogStandard").style.top=scrollTop+150+'px';
    $('#myModalStandard').show();
}
//批量添加商品彈框
function Addshop() {
//    var scrollTop = parent.document.body.scrollTop;
//    document.getElementById("modal-dialogAdd").style.top=scrollTop+50+'px';
    $('#myModalAdd').show();
}
//删除商品
function del(id) {
    var scrollTop = parent.document.body.scrollTop;
    document.getElementById("modal-dialog2").style.top=scrollTop+220+'px';
    $("#delId").val(id);
    $('#myModal2').show();
}
function hideStandard() {
    $('#myModalStandard').hide();
}
function hideProperty() {
    $('#myModalProperty').hide();
}
function hideshop() {
    $('#myModalAdd').hide();
}
    //隐藏规格弹框
    function hidestandrad(){
        $('#myModalStandard').hide();
    }
    //全選
    $(".checkbox-box input").click(function(){
        if ($(this).is(":checked")){
            $(":checkbox").prop("checked",true);   //设置所有复选框默认勾选
        }else{
            $(":checkbox").prop("checked",false);   //设置所有复选框未勾选
        }
    })
    //判断属性值是否为空
    function saveProprety(){
        var property = document.getElementsByTagName("property").value;
        var propertyPram = document.getElementsByTagName("propertyPram").value;
        if(!property||!propertyPram){
            com.toast('属性值不能为空');
            return;
        }
    }
function saveStandard(){
    var StandardPrice = $(".standard-price input[type='number']").value;
    var Standardnum = $(".standard-num input[type='number']").value;
    var mealPrice = $(".standard-meal-price input[type='number']").value;
    var mealNumber = $(".standard-meal-number input[type='number']").value;
    if(!StandardPrice){
        com.toast('商品價格不能为空');
        return false;
    }
    if(!Standardnum){
        com.toast('商品數量不能为空');
        return false;
    }
    if(!mealPrice){
        com.toast('商品餐盒費不能为空');
        return false;
    }
    if(!mealNumber){
        com.toast('商品餐盒數量不能为空');
        return false;
    }
}
    //批量添加商品成功
    function saveShop(){
        pop.loading('商品添加成功');

    }
    //提示信息
    $(function () { $("[data-toggle='tooltip']").tooltip(); });
    //添加属性
    var index = 0;
    $('#add').click(
            function() {
                $(".add-list").append(
                        '<div class="property" style="margin-top: 10px;height: 40px;">' + '<input type="text"  id="property' + index
                        + '" name="property" oninput="hidePopover1()" rel="popover1" data-trigger="focus" data-placement="bottom" style="float: left;" class="sure-pwd form-control required" placeholder="例如:口味" onfocus="showproperty(this)"  />' + '<input type="text" id="propertyPram' + index
                        + '" name="propertyPram" oninput="hidePopover2()" onfocus="showproperty(this)" rel="popoverPropertyValue" data-placement="bottom" data-placement="bottom" class="sure-pwd form-control required" style="margin-left: 10px;" placeholder="例如:少盐,用空格隔开"/>' + '<a onclick="getDel(this);" class="del-box del-btn"></a>' + '</div>');
                index++;
                Popover();
            });
    //气泡提示
    function Popover(){
        $('[rel=popover1]').popover({
            html : true,
            content: function() {
                return $('#box1-list').html();
            }
        });
        $('[rel="popoverPropertyValue"]').popover({
            html : true,
            content : function() {
                var map = {
                    "溫度" : "1",
                    "冷热" : "2",
                    "辣度" : "3",
                    "口味" : "4",
                    "甜度" : "5",
                    "加料" : "6"
                }
                var val = this.previousSibling.value;//获取前一个同胞的值

                if(val==null||val==''){
                    val = this.previousSibling.previousSibling.value;
                }
                var data = map[val.trim()];
                var htmlData = $('#box2_list' + data).html();
                return htmlData;
            }
        });
    }

    var curr_click_node;//定义一个获取焦点的变量
    // 选择属性
    $(document).on("click", ".propertyDd", function() {
        curr_click_node.value = this.innerHTML;
        $('[rel=popoverProperty]').popover('hide');
    });
    // 选择属性的值
    $(document).on("click", ".propertyVal", function() {
        var dataVal = this.innerHTML;
        if (curr_click_node.value.indexOf(dataVal.trim()) == -1) {
            curr_click_node.value = curr_click_node.value + ' ' + this.innerHTML;
        }
//        $('[rel=popoverPropertyValue]').popover('hide');
    });
    //手写自动隐藏气泡
    function hidePopover1(){
        $('[rel=popover1]').popover('hide');
    }
//    function hidePopover2(){
//        $('[rel=popoverPropertyValue]').popover('hide');
//    }
    //添加规格
    $('#addStandard').click(
            function() {
                $(".prepend-standard-show").append(
                        '<div class="standard-list" id="standard-list" >'+
                        '<div class="standard-box standard-stan">'+
                        '<span><i class="add-star" style="margin: 5px; color: #00a189;">*</i>规格</span>'+
                        '<p><input type="text" rel="popover" onfocus="showstandard(this)" data-trigger="focus" data-placement="bottom" data-placement="bottom"  maxlength="10" id="standar" class="form-control"/></p>'+
                        '</div>'+
                        '<div class="standard-box standard-price">'+
                        '<span><i class="add-star" style="margin: 5px; color: #00a189;">*</i>價格</span>'+
                        '<p><input type="number" min="0" class="form-control"/></p>'+
                        '</div>'+
                        '<div class="standard-box standard-num">'+
                        '<span><i class="add-star" style="margin: 5px; color: #00a189;">*</i>库存</span>'+
                        '<p><input type="num" placeholder="1" class="form-control" data-toggle="popover" data-placement="right" data-content="库存无限请填写-1" data-trigger="focus"/></p>'+
                        '</div>'+
                        '<div class="standard-box standard-meal-price">'+
                        '<span><i class="add-star" style="margin: 5px; color: #00a189;">*</i>餐盒價格</span>'+
                        '<p><input type="number" min="0"  placeholder="0" class="form-control"/></p>'+
                        '</div>'+
                        '<div class="standard-box standard-meal-number">'+
                        '<span><i class="add-star" style="margin: 5px; color: #00a189;">*</i>餐盒数量</span>'+
                        '<p><input type="number" min="0" placeholder="1" class="form-control"/></p>'+
                        '</div>'+
                        '<div class="del-standard-list">'+
                        '<a onclick="standardDel(this);" class="del-box del-btn"></a>'+
                        '</div>'+
                        '</div>'
                );
                //循环列表信息提示
                $(document).ready(function(){
                    $('[data-toggle="popover"]').popover();
                    /*规格气泡*/
                    $('[rel=popover]').popover({
                        html : true,
                        content: function() {
                            return $('#strandard-message').html();
                        }
                    });
                });
                //规格样式显示
                $(".standard-stan").css("display","block");
            }
    );
    /*删除商品规格*/
    function standardDel(obj) {
        $(obj).parent().parent().remove();
        debugger
        checkedStandard();
    }
    /*删除商品属性*/
    function getDel(k) {
        $(k).parent().remove();
    }
    //检查规格列表个数隐藏规格
    function checkedStandard(){
        var standardfalut=$("div[id='standard-default']").length;//编辑的区域的数量
        var standardList=$("#standard-list").length;//新增的区域的数量
        if((standardfalut+standardList)<=1){
            $(".standard-stan").css("display","none");
        }
        return true;
    }

    var curr_click_node;
    function demo(obj, tip) {
        if (tip == 1) {
            curr_click_node.value = obj.innerHTML;
        }
        if (tip == 2) {
            var dataVal = curr_click_node.nextSibling.value;
            if (dataVal.indexOf(obj.innerHTML) == -1) {
                curr_click_node.nextSibling.value = curr_click_node.nextSibling.value + ' ' + obj.innerHTML;
            }
        }
        if (tip == 3) {
            curr_click_node.value = obj.innerHTML.trim();
        }
    }
    function showstandard(obj){
        curr_click_node = obj;
    }
    function delImg() {
        $(".upload-img").find("img").css("opacity", 0);
        $(".del-img").css("opacity", 0);
        var input = $("#picfile");
        input.replaceWith(input.val('').clone(true));
        $("#upload-img").html("");
        picAllow = true;
    }
    function showproperty(obj) {
        curr_click_node = obj;
    }
    var picAllow = true;
    $(':file').change(function() {
        var file = this.files[0];
        size = file.size;
        if (size > 120000) {
            pop.a('<div style="padding: 10px;"><span>提示信息</span><p style="margin: 20px;">上传的图片不能超过100K.<p></div>');
            picAllow = false;
        } else {
            picAllow = true;
        }
    });
</script>
</body>
</html>